package com.example.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springboot.entity.RoomMark;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface RoomMarkMapper extends BaseMapper<RoomMark> {

    @Select("SELECT a.* FROM room_mark a WHERE 1=1 LIKE CONCAT('%',#{search},'%') order by dormbuild_Id,dormroom_id, time desc ")
    List<RoomMark> findAll(String search, int offset, int limit);

    @Update("update room_mark set score=#{score} ,text= #{text} ,time=now() where dormroom_id=#{dormroomId} ")
    int updateroomMark(int dormroomId, String score, String text);
}
